% TEST_ID: LANG-EXPAND-0119
% CATEGORY: language/string
% 测试 string 的拼接

function test_string_strcat()
s1 = 'Good';
s2 = 'morning';
s = strcat(s1,s2);

assert(s == 'Goodmorning');

s1 = {'abcde','fghi'};
s2 = {'jkl','mn'};
s = strcat(s1,s2)

assert(isequal(s, {'abcdejkl', 'fghimn'}))


firstnames = {'Abraham'; 'George'};
lastnames = {'Lincoln'; 'Washington'};
names = strcat(lastnames, {', '}, firstnames)

assert(isequal(names, {'Lincoln, Abraham';  'Washington, George'}))

str1 = ["John ","Mary "];
str2 = ["Smith","Jones"];
str = strcat(str1,str2)

str = strcat(str,', M.D.')

assert(["John Smith, M.D."  "Mary Jones, M.D."] == str)

assert(strcat('1', '2', '3') == '123')


str = strcat('abc', {'erd','123'}, '/')
assert(isequal(str, {'abcerd/', 'abc123/'}))


x=['abc';'def'];
y=['ab';'ef'];
z=strcat(x,y);
assert(isequal(z, ['abcab';'defef']));

x=['ab ';'def'];
y=['ab';'ef'];
z=strcat(x,y);
assert(isequal(z, ['abab ';'defef']));

x = [65 66];
z = strcat(x, 'a');
assert(isequal(z, 'ABa'));

% 如果是数值转换的空白字符,不会被删除
x = [65 32];
z = strcat(x, 'a');
assert(isequal(z, 'A a'));
end
